<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    // 组合式继承
    function Animal(color) {
      this.color = color;
      this.run = function () {
        console.log("跑")
      }
    }
    Animal.prototype.eat = function () {
      console.log("吃")
    }

    function Cat(name) {
      this.name = name;
      this.jiao = function () {
        console.log("giao")
      }
      Animal.call(this, "黑色")
    }
    Cat.prototype = new Animal()
     //优点  可以传参  可以多继承
      //缺点：运行了2次构造函数  性能略差
  </script>
</body>

</html>